
#ifndef __CCE_MATERIAL_MATERIALOVERVIEWDIALOG_H__
#define __CCE_MATERIAL_MATERIALOVERVIEWDIALOG_H__

#include <qdialog.h>
#include <ui_materialoverviewwidget.h>
#include <material/materialeditor.h>
#include <material/materialmanager.h>

class QButtonGroup;
class QStackedLayout;
class QTabWidget;
class cceMaterialMaterialOverview;
class cceMaterialEffectOverview;
class cceMaterialProgramOverview;
class cceMaterialShaderOverview;
class cceMaterialTextureOverview;
class cceMaterialOverviewDialog : public QDialog
{
	Q_OBJECT
private:
	Ui::MaterialOverviewWidget	_gui;

	QButtonGroup								*_buttonGroup;
	QStackedLayout							*_overviewLayout;
  QTabWidget                  *_editorTabs;

  QMap<cceMaterialItem*, cceMaterialEditorAbstract*>  _editors;

  void TryCloseEditors ();
  void EnsureEditorsOpen ();


  cceMaterialTextureOverview  *_texturesOverview;
  cceMaterialShaderOverview   *_shaderOverview;
	cceMaterialProgramOverview	*_programOverview;
  cceMaterialEffectOverview   *_effectsOverview;
  cceMaterialMaterialOverview *_materialsOverview;

  cceMaterialManager          *_manager;

  void ShowEditor (cceMaterialOverviewAbstract* overview, cceMaterialItem* item);

private slots:

  void ButtonGroupClicked (QAbstractButton* );
  void EditorNameChanged (const QString& name);
  void ShowEditorByOverview (cceMaterialItem* item);
  void ShowEditorEvaluateByType (cceMaterialItem* item);
  void CloseEditor (cceMaterialItem* item);

  void Save ();
  void SaveAll ();
  void Export ();

  void on_labelMaterialsMenu_Clear ();

  void CloseTab();
  void TabCloseRequested(int);
public:
  cceMaterialOverviewDialog (cceMaterialManager* manager, QWidget* parent = 0);

  void ShowEditor (cceMaterialItem *item);

public slots:
  virtual void reject ();
};

#endif /* ! __CCE_MATERIAL_MATERIALOVERVIEWDIALOG_H__ */

